package com.fruit.alipay.util;

import com.alipay.api.domain.AlipayTradeOrderMobilepayModel;
import com.alipay.api.internal.util.json.JSONWriter;
import com.alipay.api.request.AlipayTradeWapPayRequest;

/**
 * 
 * @ClassName: AlipayRequestBuilder
 * @author 葛欢欢
 * @version 2017.11.30 16:40
 */
public class AlipayRequestBuilder {
	private AlipayTradeOrderMobilepayModel model = new AlipayTradeOrderMobilepayModel();
	private AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @return AlipayTradeOrderMobilepayModel
	 */
	public AlipayTradeOrderMobilepayModel getModel() {
		return model;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param mod
	 *            mod
	 */
	public void setModel(AlipayTradeOrderMobilepayModel mod) {
		this.model = mod;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @return AlipayTradeWapPayRequest
	 */
	public AlipayTradeWapPayRequest getRequest() {
		request.setBizContent(new JSONWriter().write(model, true));
		return request;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param req
	 *            req
	 */
	public void setRequest(AlipayTradeWapPayRequest req) {
		this.request = req;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param returnUrl
	 *            returnUrl
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setReturnUrl(String returnUrl) {
		request.setReturnUrl(returnUrl);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param notifyUrl
	 *            notifyUrl
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setNotifyUrl(String notifyUrl) {
		request.setNotifyUrl(notifyUrl);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param outTradeNo
	 *            outTradeNo
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setOutTradeNo(String outTradeNo) {
		model.setOutTradeNo(outTradeNo);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40 
	* @param totalAmount totalAmount
	* @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setTotalAmount(String totalAmount) {
		model.setTotalAmount(totalAmount);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param subject
	 *            subject
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setSubject(String subject) {
		model.setSubject(subject);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param body
	 *            body
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setBody(String body) {
		model.setBody(body);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param sellerId
	 *            sellerId
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setSellerId(String sellerId) {
		model.setSellerId(sellerId);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param timeoutExpress
	 *            timeoutExpress
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setTimeoutExpress(String timeoutExpress) {
		model.setTimeoutExpress(timeoutExpress);
		return this;
	}

	/**
	 * 
	 * @author 葛欢欢
	 * @version 2017.11.30 16:40
	 * @param authToken
	 *            authToken
	 * @return AlipayRequestBuilder
	 */
	public AlipayRequestBuilder setAuthToken(String authToken) {
		model.setAuthToken(authToken);
		return this;
	}
}
